public class BinaryTree {

    static class TreeNode{
        public char val;
        public TreeNode left;
        public TreeNode right;

        public TreeNode(char val) {
            this.val = val;
        }

        public TreeNode CreateTree(){
            TreeNode A = new TreeNode('A');
            TreeNode B = new TreeNode('B');
            TreeNode C = new TreeNode('C');
            TreeNode D = new TreeNode('D');
            TreeNode E = new TreeNode('E');
            TreeNode F = new TreeNode('F');
            TreeNode G = new TreeNode('G');
            TreeNode H = new TreeNode('H');

            A.left = B;
            A.right = C;
            B.left = D;
            B.right = E;
            C.left = F;
            C.right = G;
            E.right = H;

            return A;
        }

        public void PrevOrder(TreeNode root){
            if(root == null){
                return;
            }
            System.out.println(root.val+" ");
            PrevOrder(root.left);
            PrevOrder(root.right);
        }

        public void InOrder(TreeNode root){
            if(root == null){
                return;
            }
            InOrder(root.left);
            System.out.println(root.val+" ");
            InOrder(root.right);
        }

        public void PostOrder(TreeNode root){
            if(root == null){
                return;
            }
            PostOrder(root.left);
            PostOrder(root.right);
            System.out.println(root.val+" ");
        }
    }
}